home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 352 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: jhunix.hcf.jhu.edu!hbien
  2. From: hbien@jhunix.hcf.jhu.edu (Harold Bien)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Efficiency Question
  5. Date: 4 Jan 1996 01:31:47 GMT
  6. Organization: HCF - Johns Hopkins University, Baltimore, Maryland, USA
  7. Message-ID: <4cfam3$r8h@news.jhu.edu>
  8. References: <4bsc04$bd1@micro.internexus.net>
  9. NNTP-Posting-Host: 128.220.2.5
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Laszlo Vecsey (master@micro.internexus.net) wrote:
  13. : Shown below are a few different ways of clearing a screen using an escape 
  14. : sequence. It sends the escape character and [2J to stdout.
  15.  
  16. :    cout << char(27) << char('[') << char('2') << char('J');
  17. :    cout << char(27) << "[2J";
  18. :    cout << "\27[2J";
  19.  
  20. : Now my question is, which one of these will most likely compile out to 
  21. : the least instructions? For example, with the first method would there 
  22.  
  23.     Are you looking for faster execution times or smaller code 
  24. space?  If you are interested purely in the "number of instructions" 
  25. generated, try compiling to assembly source (if Borland, I think its 
  26. -s).  Then, compare each of the lines (Borland does a nice job of 
  27. commenting each ASM section with the C(++) source).  If you get an 
  28. answer, please post.  I'm curious but too lazy to try it myself.
  29.